<?php

/**
 * SupportController
 *
 * @author yukio
 * @version $Id$
 */

require_once 'Zend/Controller/Action.php';
require_once 'Okute/Exception.php';
require_once 'Okute/Util/Data.php';

require_once APPLICATION_PATH . '/models/PartyModel.php';
require_once APPLICATION_PATH . '/models/AclModel.php';

class SupportController extends Zend_Controller_Action
{
    /**
     * セッション管理用変数
     * @var Zend_Session_Namespace
     */
    private $_session;

    /**
     * アクセスコントロール
     * @var Zend_Acl
     */
    private $_acl;

    /**
     * Supportコントローラの初期化
     *
     * @return void
     */
    public function init() {
        $this->_session = new Zend_Session_Namespace('okute');
        $this->_acl = Zend_Registry::get('acl');
        $this->view->base = $this->getRequest()->getBaseUrl();
    }

    /**
     * indexActionは支援画面のメニューを表示する際の前処理を行う。
     *
     * @return void
     */
    public function indexAction() {
        if (!$this->_acl->isAllowed($this->_session->role, AclModel::RES_PARTY_MENU)) {
            throw new Okute_Exception('Access Control Error');
        }
        $util = new Okute_Util_Data($this->view);
        $this->view->party_id = $this->_session->party->party_id;
        if ($this->_session->format === 'pc') {
            $this->_forward('index', 'list');
        }
    }

}